Chris Pollett > Old Classes >
CS154

( Print View )

Student Corner:
  [Grades Sec1]

  [Submit Sec1]

  [Class Sign Up Sec1]

  [
Lecture Notes]
  [Discussion Board]

Course Info:
  [Texts & Links]
  [Topics/Outcomes]
  [Outcomes Matrix]
  [Grading]
  [HW/Quiz Info]
  [Exam Info]
  [Regrades]
  [Honesty]
  [Additional Policies]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]  [Quizzes]

Practice Exams:
  [Mid]  [Final]

                           












CS154 Spring 2011Practice Midterm

To study for the midterm I would suggest you: (1) Know how to do (by heart) all the practice problems. (2) Go over your notes at least three times. Second and third time try to see how much you can remember from the first time. (3) Go over the homework problems. (4) Try to create your own problems similar to the ones I have given and solve them. (5) Skim the relevant sections from the book. (6) If you want to study in groups, at this point you are ready to quiz each other. The practice midterm is below. Here are some facts about the actual midterm: (a) It is closed book, closed notes. Nothing will be permitted on your desk except your pen (pencil) and test. (b) You should bring photo ID. (c) There will be more than one version of the test. Each version will be of comparable difficulty. (d) One problem (less typos) on the actual test will be from the practice test.

  1. Which properties of an equivalence relation does x != y satisfy?
  2. Imagine we encode tuples of binary numbers by using 10 to encode a binary 0; 01, to encode a binary 1; and 11, to encode a tuple separator. Give a DFA which recognizes all 3-tuples over this encoding (3-tuples have two tuple separators).
  3. Consider the language `{0, 1}^star1{0, 1}^(k-1)`. Give a `k+1` state NFA for this language. Suppose one applied the power set construction to this NFA, show the number of states reachable from the start state in this machine is `2^k`.
  4. Let `L` be a language consisting of a single string of length `n`. Prove that there is a DFA for this language. Then argue that a minimal DFA for this language needs at least `n` transitions. (So DFAs are not so great for compression of single strings, people do consider NFA transducers with advice though). Suppose we had a language `L'` with two strings of length `n` show that it is possible for `L'` to have fewer than `2n` states.
  5. Give a regular expression for your answer to (2) above. Then use the algorithm from class, showing steps, to convert your answer to an NFA.
  6. Let `L` be the language consisting of all strings over '(' and ')' which are not valid parenthesizations. Show `L` is not regular.
  7. Give a PDA for `L` of the last problem.
  8. Give an example of an ambiguous grammar. Define what an inherently ambiguous language is.
  9. Consider the CFG `G` with rules `S -> oBc`, `B->epsilon | S | BB`. Show step-by-step using the algorithm from class how to convert `G` to a CFG in Chomsky Normal Form.
  10. Show step-by-step what the CYK algorithm using the grammar of the last problem would do on the strings `ococ` and `oco`.